package com.ds.infrastructure.hyperspace.container.internal.transport;

import com.ds.infrastructure.hyperspace.container.internal.HyperspaceThreadFactory;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.ServerSocketChannel;
import io.netty.channel.socket.SocketChannel;

/**
 * @author  Weishaoying
 */
public interface NettyTransportFactory<T extends EventLoopGroup> {

    /**
     * Socket class for netty
     * @return
     */
    Class<? extends SocketChannel> socketChannelClass();

    /**
     * Server socket class for netty
     * @return
     */
    Class<? extends ServerSocketChannel> serverSocketChannelClass();

    /**
     * Create event loop group for netty
     * @param threadFactory
     * @param threadNum
     * @return
     */
    T newEventLoopGroup(HyperspaceThreadFactory threadFactory, int threadNum);

    /**
     * Create acceptor event loop group for netty
     * @param threadFactory
     * @param threadNum
     * @return
     */
    T newAcceptorEventLoopGroup(HyperspaceThreadFactory threadFactory, int threadNum);

}
